# 构建对象对战平台object_play
# 1 英雄一代战机（战斗力60）与敌军战机（战斗力70）对抗。英雄1代战机失败！
# 2 卧薪尝胆，英雄二代战机（战斗力80）出场！，战胜敌军战机！
# 3 对象对战平台object_play, 代码不发生变化的情况下, 完成多次战斗  attack / power
# 思路分析: 抽象战机类 HeroFighter  AdvHeroFighter；敌机EnemyFighter; 构建对象战斗平台,使用多态实现

# 1代战机
class HeroFighter(object):
    def power(self):
        return 70


# 2代战机
class AdvHeroFighter(HeroFighter):
    def power(self):
        return 90


# 第3代战机 16:14
class AdvAdvHeroFighter(AdvHeroFighter):
    def power(self):
        return 90


class EnemyFighter(object):
    def attack(self):
        return 80

class AAAA(object):
    def power(self):
        return 100


# 搭建战斗场景 让对象唱戏  16:12
# 框架 框架 可以把后来人写的代码给拉起来
def object_play(myobj, enemyfighter):
    if myobj.power() > enemyfighter.attack():
        print('英雄战机胜利 敌军失败')
    else:
        print('英雄战机失败 敌军胜利')


if __name__ == '__main__':

    # 1 准备对象
    herofighter = HeroFighter()
    advherofighter = AdvHeroFighter()
    enemyfighter = EnemyFighter()

    # 2 战斗第1次
    print('----------Round 1---------------')
    object_play(herofighter, enemyfighter)
    #
    # # 3 战斗第2次
    print('----------Round 2---------------')
    object_play(advherofighter, enemyfighter)
    #
    # # 4 第3次战斗
    print('----------Round 3---------------')
    mya = AAAA()
    object_play(mya, enemyfighter)
    #
    # 5 第4次战斗
    print('----------Round 4---------------')
    advadvherofighter = AdvAdvHeroFighter()
    object_play(advadvherofighter, enemyfighter)


    pass

